package com.my.study.io.properties;

import java.io.*;
import java.util.Properties;

/**
 * @author Carlos
 * @version 1.0
 * @Description
 * @date 2021/6/27 12:55
 **/
public class PropertiesTest {


    public static void main(String[] args) throws IOException {
        String pre_path = Thread.currentThread().getContextClassLoader().getResource("").getPath();
        pre_path += "my.properties";

        Properties properties = new Properties();
        properties.load(new FileReader(pre_path));

        String ip = properties.getProperty("ip");

        properties.list(System.out);


    }

    private static void test01(String pre_path) {
        String line;
        try (BufferedReader reader = new BufferedReader(
                new FileReader(pre_path))) {
            while ((line = reader.readLine()) != null) {
                System.out.println(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
